package com.touni.lambda.diycollectors;

import com.touni.lambda.BaseModel;
import java.util.*;

/**
 * @ClassName : DIyCollectorsDemo
 * @Description :
 * @Author : lwq
 * @Date: 2020-11-23 09:53
 */
public class DIyCollectorsDemo {

    public static void main(String[] args) {
        diyCollector();
    }

    public static void diyCollector(){
        /*Set<BaseModel> modelSet = baseList.stream().collect(new ToSetCollector<BaseModel>());
        System.out.println(modelSet);*/
       /* HashSet<Object> collect = baseList.stream().collect(HashSet::new, Set::add, (set1, set2) -> set1.add(set2));
        System.out.println(collect);*/
        //===以上两个方法  效果相同   只是第二个collect方法不能传递任何Characteristics，所以它永远都是一个IDENTITY_FINISH和
        //CONCURRENT但并非UNORDERED的收集器。137
        /*Map<String, BaseModel> collect1 = baseList.stream().collect(new ComplexCollector<>());//todo bug
        System.out.println(collect1);*/


    }


    static List<BaseModel> baseList;

    static {
        baseList = new ArrayList<BaseModel>();
        baseList.add(new BaseModel("刘华",26,"男"));
        baseList.add(new BaseModel("刘华",26,"男"));
        baseList.add(new BaseModel("刘已",26,"女"));
        baseList.add(new BaseModel("是啥",56,"男"));
        baseList.add(new BaseModel("自行车",16,"女"));
        baseList.add(new BaseModel("秩序册",89,"男"));
        baseList.add(new BaseModel("儿女",42,"男"));
        baseList.add(new BaseModel("瞅瞅",19,"女"));
        baseList.add(new BaseModel("分隔",52,"男"));
        baseList.add(new BaseModel("四渡赤水",46,"女"));
        //baseList.add(new BaseModel("撒旦法",41,"男"));
    }
}
